/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package kmeansclustering;

import java.awt.Color;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.Vector;

/**
 *
 * @author hoangtam
 */
public class DataNormal {
    static Vector list_points;
    
    public Vector readData(){
       
        try (FileReader fr = new FileReader("D:\\[Normalized]2Ddata.txt")) {
            //Bạn có thể tạo dữ liệu văn bản dạng UTF-8 - Tiếng Việt
            BufferedReader br = new BufferedReader(fr);
            String s;
            list_points=new Vector();
            //Đọc từng dòng văn bản!
            int i=0;
            while ((s = br.readLine()) != null) {
                StringTokenizer tk=new StringTokenizer(s);
                String t1=tk.nextToken();
                String t2=tk.nextToken();
                PointNormal p=new PointNormal(Integer.parseInt(t1), Integer.parseInt(t2),i, Color.red);
                list_points.add(p);
                i++;
                
            }
            
//            for(int i=0;i<list_point.size();i++){
//                Point t=(Point) list_point.get(i);
//                System.out.println(t.x+  "     ==="  +t.y);
//            }
        }catch(IOException e){
            System.out.println("Đã có lỗi xảy ra!");
        }
        return list_points;
    }
    public static void main(String[]a){
        
        DataNormal f=new DataNormal();
        f.readData();
        
    }
}
